<?php
require_once '../config/config.php';
require_once '../lib/member.php';
require_once '../lib/user.php';
require_once '../lib/kelas.php';
require_once '../lib/produk.php';

$config=new config();
$config->connect();

session_start();
if (!isset($_SESSION['MM_Username'])){
	$togo="../login.php";
	header ("Location:$togo");
}

if(!ISSET($_GET['id'])){
$Member_Dao=new Member_Dao();
$data=$Member_Dao->get_all();
}


?>
<?php include("header_admin.php") ?>
<?php include("menu_kiri_admin.php") ?>
<style type="text/css">
<!--
.style1 {
	color: #CC0099;
	font-weight: bold;
	font-size: 24px;
}
.style3 {font-size: 14px}
.style4 {font-size: 16px}
.style5 {color: #990000}
.style6 {font-size: 18px}
-->
</style>



<div id="body">
<div class="topbox">
                  <p align="center" class="style1 style5">Daftar Member</p>
<p><span class="style6">Jumlah Member:<?php echo count($data);?> </span><br>    
                                  </p>
<table width="" border="1" cellpadding="5" cellspacing="0">
                    <tr>
                    <th width="20"><span class="style4">No</span></th>
                      <th width="55"><span class="style4">Nama</span></th>
                      <th width="48"><span class="style4">Alamat</span></th>
                      <th width="56"><span class="style4">E-mail</span></th>
                      <th width="86"><span class="style4">No. Telepon</span></th>
                      <th width="94"><span class="style4">Tanggal Daftar</span></th>
                      <th width="75">Status</th>
                  
                      <th width="98">&nbsp;</th>
                    </tr>
                    
                  <?php
				  $i=1;
				  foreach ($data as $member) {
				  $User_Dao=new User_Dao();
				  $user=$User_Dao->get_id($member->id);
				  
				  ?>
             
                    <tr>
                    <td><span class="style3"><?php echo $i;?></span></td>
                      <td><span class="style3"><?php echo $member->nama;?></span></td>
                      <td><span class="style3"><?php echo $member->alamat;?></span></td>
                      <td><span class="style3"><?php echo $user->email;?></span></td>
                      <td><span class="style3"><?php echo $member->no_telp;?></span></td>
                      <td><span class="style3"><?php echo $member->tgl_daftar;?></span></td>
                      <td><span class="style3"><?php if($member->banned==0){echo "Aktif";}if($member->banned==1){echo "Blokir";}?></span></td>
                      <td><?php echo "<a href=\"ubah_status.php?id=$member->id\">";
					  echo "ubah status </a> ";?></td>
                      
                    </tr>
                    <?php $i++;}?>
    </table>
                  <form id="form1" name="form1" method="post" action="">
                    <label>
                      <input type="submit" name="Lihat Selengkapnya" id="Lihat Selengkapnya" value="Lihat Selengkapnya" />
                    </label>
                    <a href="daftar_member.php">Lihat Selengkapnya</a>
                    <div align="right"></div>
                    <div align="center"></div>
    </form>
                  <p><br> 				  
    </p>
</div> 
</div>
          
         <div class="clear"></div>
         <?php include("../footer.php") ?>